<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>组合对话框</title>
        <#include "/pubHeadStyle.html">
    </head>
    <body>
        <div class="resAllocationDiv">
            <ul id="roleResAllocation" class="ztree ccpui-listZtree" style="top:0;bottom:60px;"></ul>
            <div style="position: absolute;bottom:10px;left:33%">
                <a class="layui-btn saveAllocation">确定</a>
                <a class="layui-btn reset">重置</a>
                <a class="layui-btn cencalData layui-btn-danger">取消</a>
            </div>
        </div>
        <script>

            layui.config({
                base: serverPath.formPath + staticPath.formPath //静态资源所在路径
            }).extend({
                index: 'index' //主入口模块
            }).use(['index', 'table', 'layer', 'jquery', 'form', 'tree', 'commons', 'common', 'totalFilter', 'setter'], function () {
                var table = layui.table, layer = layui.layer, setter = layui.setter, commons = layui.commons,
                    common = layui.common;
                $(".cencalData").on('click', function () {
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                });
                $(".reset").on('click', function () {
                    window.location.reload();
                });
                $.ajax({
                    url: serverPath.formPath + setter.sysLinkPath + "globalType/list",
                    type: "post",
                    dataType: 'json',
                    data: {"catKey": "FORM_TYPE", "hasRoot": 1},
                    success: function (data) {
                        var zNodes = data.data;
                        var setting = {
                            check: {
                                enable: true
                            },
                            view: {
                                showLine: false,
                                nameIsHTML: true, //允许name支持html
                                selectedMulti: false
                            },
                            edit: {
                                enable: false,
                                editNameSelectAll: false
                            },
                            data: {
                                simpleData: {
                                    enable: true,
                                    idKey: "typeId",
                                    pIdKey: "parentId"

                                },
                                key: {
                                    name: "typeName"
                                }
                            },

                            callback: {
                                // onClick: onClickType
                            }
                        };
                        $.fn.zTree.init($('#roleResAllocation'), setting, zNodes);
                    }
                });
                $(".resAllocationDiv .saveAllocation").bind('click', function () {
                    var treeObj = $.fn.zTree.getZTreeObj("roleResAllocation");
                    var nodes = treeObj.getCheckedNodes(true);
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                    parent.layer.alert(JSON.stringify(nodes), {title: '提示', area: ['360px', '300px']});
                })
            })
        </script>
    </body>
</html>